package com.tjec.project.businessWorkbench.mapper;

import com.tjec.project.businessWorkbench.domain.BmsArchivedAttachment;
import com.tjec.project.businessWorkbench.domain.BmsBusinessDocArchive;
import com.tjec.project.businessWorkbench.domain.BmsProjectDoc;
import com.tjec.project.businessWorkbench.dto.BmsAttachmentDto;

import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 资料归档Mapper接口
 * 
 * @author pangyongfeng
 * @date 2020-05-18
 */
public interface BmsBusinessDocArchiveMapper 
{
    /**
     * 查询资料归档
     * 
     * @param guid 资料归档ID
     * @return 资料归档
     */
    public BmsBusinessDocArchive selectBmsBusinessDocArchiveByGuid(String guid);

    /**
     * 查询资料归档列表
     * 
     * @param bmsBusinessDocArchive 资料归档
     * @return 资料归档集合
     */
    public List<BmsBusinessDocArchive> selectBmsBusinessDocArchiveList(BmsBusinessDocArchive bmsBusinessDocArchive);
    
    /**
     * 查询资料归档列表
     * 
     * @param bmsBusinessDocArchive 资料归档
     * @return 资料归档集合
     */
    public List<BmsBusinessDocArchive> selectBmsBusinessDocArchiveListInDoc(BmsBusinessDocArchive bmsBusinessDocArchive);

    /**
     * 新增资料归档
     * 
     * @param bmsBusinessDocArchive 资料归档
     * @return 结果
     */
    public int insertBmsBusinessDocArchive(BmsBusinessDocArchive bmsBusinessDocArchive);

    /**
     * 修改资料归档
     * 
     * @param bmsBusinessDocArchive 资料归档
     * @return 结果
     */
    public int updateBmsBusinessDocArchive(BmsBusinessDocArchive bmsBusinessDocArchive);

    /**
     * 删除资料归档
     * 
     * @param guid 资料归档ID
     * @return 结果
     */
    public int deleteBmsBusinessDocArchiveByGuid(String guid);

    /**
     * 批量删除资料归档
     * 
     * @param guids 需要删除的数据ID
     * @return 结果
     */
    public int deleteBmsBusinessDocArchiveByGuids(String[] guids);
    
    /**
     * 新增资料归档和附件对应关系表
     * 
     * @param bmsArchivedAttachments 资料归档id和附件对应关系类
     * @return 结果
     */
    public int insertBmsArchivedAttachment(List<BmsArchivedAttachment> bmsArchivedAttachments);
    
    /**
     * 根据资料归档guid删除对应关系表
     * 
     * @param archiveIds 资料归档id集合
     * @return 结果
     */
    public int deleteBmsArchivedAttachmentByArchiveIds(List<String> archiveIds);

    /**
     * 根据项目ID查询该项目下资料归档
     *
     * @param projectId 项目id
     * @return 结果
     */
    public List<BmsBusinessDocArchive> selectBmsBusinessDocArchiveListByProjectId(String projectId);
    
    public int importDocArchivedBatach(List<BmsBusinessDocArchive> bmsBusinessDocArchives);
    
    /**
     * 根据业务id查找是否存在必须文件是否已经上传
     * @param businesId 业务id
     * @return 
     */
    public int isExistArchivedDoc(String businesId);
    
    /**
     * 根据业务id删除资料归档文件
     * @param businessId
     * @return
     */
    public int deleteDocArchiveByBusinessId(String businessId);
    
    /**
     * 根据业务id查询列表
     * @param businessId 业务id
     * @return
     */
    public List<BmsBusinessDocArchive> selectDocArchiveByBusinessId(String businessId);
    
    /**
     * 检查用户是否是项目经理或者项目负责人
     * @param userId 登陆人用户id
     * @param businessId 业务id
     * @return
     */
    public String checkUser(@Param("userId") String userId, @Param("businessId")String businessId);
    
    /**
     * 检查用户是否是项目经理或者项目负责人
     * @param userId 登陆人用户id
     * @param businessId 业务id
     * @return
     */
    public String checkUserByProjectId(@Param("userId") String userId,@Param("projectId")String projectId);
    
    public List<BmsBusinessDocArchive> selectDocArchiveAtt(String businessId);

    List<BmsBusinessDocArchive> selectBmsBusinessDocArchiveListInDocQuery(BmsBusinessDocArchive bmsBusinessDocArchive);
    
    /**
     * 查询资料归档列表
     * 
     * @param bmsBusinessDocArchive 资料归档
     * @return 资料归档集合
     */
    public List<BmsAttachmentDto> selectAttachments(BmsBusinessDocArchive bmsBusinessDocArchive);

    List<BmsBusinessDocArchive> selectBmsBusinessDocArchiveListByBusinessId(String businessId);

    List<BmsBusinessDocArchive> selectBmsBusinessDocArchiveListAttByBusinessId(String businessId);
}
